/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package awt;

import java.awt.Canvas;
import java.awt.Graphics;

/**
 *
 * @author Lab
 */
public class Dibujo extends Canvas {
private int x1;
private int x2;
private int y1;
private int y2;
private int clicks;

    @Override
public void paint (Graphics g){
    if (clicks ==1){
        g.drawOval(x1-10, y1-10,20,20);
    }else {
        g.drawLine((int)(x1+(x2-x1)/2),y1,x2,(int)(y1+(y2-y1)/2));
        g.drawLine((int)(x1+(x2-x1)/2),y1,x1,(int)(y1+(y2-y1)/2));
        g.drawLine(x1,(int)(y1+(y2-y1)/2),(int)(x1+(x2-x1)/2),y2);
        g.drawLine(x2,(int)(y1+(y2-y1)/2),(int)(x1+(x2-x1)/2),y2);
    }
    }
    public static void main (String args []){
        Dibujo d = new Dibujo(); 
    }
}
